export const toLink = function (path, params) {
  if (params && params !== null) {
    wx.navigateTo({
      url: path + queryData(params)
    })
  } else {
    wx.navigateTo({
      url: path
    })
  }
}

function queryData(data) {
  var str = '';
  for (var i in data) {
    str += i + "=" + data[i] + '&';
  }
  if (str) {
    str = '?' + str;
    str = str.substr(0, str.length - 1);
  }
  return str;
}